﻿using System;

namespace ExFlash.Tags
{
    public class DefineBinaryDataTag : Tag
    {
        public ushort CharacterId
        {
            get;
            private set;
        }

        public Byte[] Data
        {
            get;
            private set;
        }

        public DefineBinaryDataTag(int len, int offset)
            : base(TagCodes.DefineBinaryData, len, offset)
        {

        }
        public override void SwfDeserialize(BinaryBitReader reader)
        {
            long startIndex = reader.Position;
            
            CharacterId = reader.ReadUInt16();

            // Reserved
            reader.Position += 4;

            int dataLength = TagLength - (int)(reader.Position - startIndex);
            Data = new Byte[dataLength];
            reader.Read(Data, 0, dataLength);
        }

        public override void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }
    }
}
